var BaseController = new require("./basecontroller");

function Controller(){
  BaseController.call(this);
}

Controller.prototype = Object.create (BaseController.prototype);
Controller.prototype.constructor = Controller;
Controller.prototype.FORM_ENTRIES = Array("name", "address" , "contact_number", "contact_person", "ip", "status","company_id");
Controller.prototype.SEARCH_ENTRIES = Array("name", "address" , "contact_number", "contact_person", "ip", "status","company_id", "user.username");
Controller.prototype.TABLE = "branch"; //table for this controller
Controller.prototype.CONTROLLER = "branch"; //controllername
Controller.prototype.PAGE = Controller.prototype.CONTROLLER;
Controller.prototype.FORM_VIEW = "backend/branch/branch-form";
Controller.prototype.LIST_VIEW = "backend/branch/branch-list";
Controller.prototype.VALIDATION_RULES = "branch";
Controller.prototype.RECORDS_PER_PAGE = 20;

Controller.prototype.LIST_JOIN_TABLES = 
{  "company_id" : //field
	{ 							
		table : "company",//table
		joinType : "left",
		fields: Array('id','name','address')//fields to retrieve
	},
	"added_by" : //field
	{ 							
		table : "user",//table
		joinType : "left",
		fields: Array('id','username', 'firstname', 'lastname')//fields to retrieve
	}
}; 

Controller.prototype.FORM_JOIN_TABLES = Controller.prototype.LIST_JOIN_TABLES

//for reference data
Controller.prototype.REFERENCE_DATA_LIST = {
		0 : {name : "companyList", query : "select id,name  from company where archived = 1 ", appendCustomWhereClause: false}
}

module.exports = new Controller();
